package com.swotxu.common.conf.anno;

import com.swotxu.common.conf.MallSessionConfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 自定义开启注册商城 RedisSession
 *
 * 1、使用此注解，需在pom.xml中加入相关依赖
 *         <!-- 接入 Redis -->
 *         <dependency>
 *             <groupId>org.springframework.boot</groupId>
 *             <artifactId>spring-boot-starter-data-redis</artifactId>
 *             <scope>provided</scope>
 *             <version>${spring.boot.version}</version>
 *             <exclusions>
 *                 <exclusion>
 *                     <groupId>io.lettuce</groupId>
 *                     <artifactId>lettuce-core</artifactId>
 *                 </exclusion>
 *             </exclusions>
 *         </dependency>
 *         <!-- 改用 jedis 客户端 -->
 *         <dependency>
 *             <groupId>redis.clients</groupId>
 *             <artifactId>jedis</artifactId>
 *             <scope>provided</scope>
 *             <version>${jedis.version}</version>
 *         </dependency>
 *         <!-- 整合 SpringSession -->
 *         <dependency>
 *             <groupId>org.springframework.session</groupId>
 *             <artifactId>spring-session-data-redis</artifactId>
 *             <scope>provided</scope>
 *             <version>${spring.boot.version}</version>
 *         </dependency>
 *
 * 2、配置文件配置
 * spring:
 *   redis:
 *     host: 192.168.56.10
 *     port: 6379
 *   session:
 *     store-type: redis
 *
 * @Date: 2022/4/30 17:44
 * @Author: swotXu
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
@Import({MallSessionConfig.class})
@Configuration
@EnableRedisHttpSession
public @interface EnableMallRedisHttpSession {

}
